class_name JumpAbility
extends GameplayAbility


func _activate(_target: AbilitySystemComponent) -> void:
	var character = _target.get_parent() as CharacterBody2D
	if character:
		var jump_height: float = _target.attribute_set.get_attribute("jump_height").current_value
		var jump_time_to_peak: float = _target.attribute_set.get_attribute("jump_time_to_peak").current_value
		var jump_speed: float = ((2.0 * jump_height) / jump_time_to_peak)
		character.velocity.y -= jump_speed

		# 替代使用 jump_cooldown_effect 来实现的跳跃冷却
		_target.tag_manager.add_tag(GameplayTagLibrary.Cooldown_Jump)
